bitkeeper revision 1.122.1.11 (3e70b55emf8PRsy8RtiLO9uyIiycyA)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 13 Mar 2003 16:44:14 +0000 (16:44 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 13 Mar 2003 16:44:14 +0000 (16:44 +0000)
network.c, xl_block.c, sd.c, ide-xeno.c, xen_segment.c, keyhandler.c:
  Fix IDE and SCSI initialisation. Add to entropy pool from Xenolinux net & blkdev interrupts. Add a graceful reboot handler.

xen/common/keyhandler.c
xen/drivers/block/xen_segment.c
xen/drivers/ide/ide-xeno.c
xen/drivers/scsi/sd.c
xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c
xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c

index 1f8a84ea32e1b60de8d5eb403199ae9c0174cc0c..19943fff3e9ad609024e9f10d614621be3a249b1 100644 (file)
@@ -42,7 +42,7 @@ key_handler *get_key_handler(u_char key)
 }
 
 
-void show_handlers(u_char key, void *dev_id, struct pt_regs *regs) 
+static void show_handlers(u_char key, void *dev_id, struct pt_regs *regs) 
 {
     int i; 
 
@@ -56,7 +56,7 @@ void show_handlers(u_char key, void *dev_id, struct pt_regs *regs)
 }
 
 
-void dump_registers(u_char key, void *dev_id, struct pt_regs *regs) 
+static void dump_registers(u_char key, void *dev_id, struct pt_regs *regs) 
 {
     extern void show_registers(struct pt_regs *regs); 
 
@@ -65,13 +65,19 @@ void dump_registers(u_char key, void *dev_id, struct pt_regs *regs)
     return; 
 }
 
-void halt_machine(u_char key, void *dev_id, struct pt_regs *regs) 
+static void halt_machine(u_char key, void *dev_id, struct pt_regs *regs) 
 {
     printk("'%c' pressed -> rebooting machine\n", key); 
     machine_restart(NULL); 
     return; 
 }
 
+static void kill_dom0(u_char key, void *dev_id, struct pt_regs *regs) 
+{
+    printk("'%c' pressed -> gracefully rebooting machine\n", key); 
+    kill_other_domain(0, 0);
+    return;
+}
 
 
 /* XXX SMH: this is keir's fault */
@@ -125,6 +131,7 @@ void initialize_keytable()
     add_key_handler('p', perfc_printall, "print performance counters"); 
     add_key_handler('P', perfc_reset,    "reset performance counters"); 
     add_key_handler('q', do_task_queues, "dump task queues + guest state");
+    add_key_handler('B', kill_dom0, "reboot machine gracefully"); 
     add_key_handler('R', halt_machine, "reboot machine ungracefully"); 
     
     return; 
index 4a09f511a6d0b73a1c00a3d2b4a3ba1004f5fbe7..dbfe699030318c5f481f88706ba3a7e8d3a8ecb4 100644 (file)
@@ -101,6 +101,7 @@ void xen_segment_probe(struct task_struct *p, xen_disk_info_t *raw_xdi)
 {
     int loop, i;
     xen_disk_info_t *xdi = map_domain_mem(virt_to_phys(raw_xdi));
+    unsigned long capacity = 0, device;
 
     for ( loop = 0; loop < XEN_MAX_SEGMENTS; loop++ )
     {
@@ -108,13 +109,12 @@ void xen_segment_probe(struct task_struct *p, xen_disk_info_t *raw_xdi)
              (xsegments[loop].domain != p->domain) )
             continue;
 
-        xdi->disks[xdi->count].device = 
-            MK_VIRTUAL_XENDEV(xsegments[loop].segment_number);
+        device = MK_VIRTUAL_XENDEV(xsegments[loop].segment_number);
         for ( i = 0; i < xsegments[loop].num_extents; i++ )
-        {
-            xdi->disks[xdi->count].capacity += 
-                xsegments[loop].extents[i].size;
-        }
+            capacity += xsegments[loop].extents[i].size;
+
+        xdi->disks[xdi->count].device   = device;
+        xdi->disks[xdi->count].capacity = capacity;
         xdi->count++;
     }
 
index 49ecde74e4ac76d44bc8a7bd88f7d02cc48eef20..351e2cbcf5062aee9fe00fdb7b01cce082c18428 100644 (file)
@@ -12,7 +12,7 @@ void ide_probe_devices(xen_disk_info_t* xdi)
     int loop;
     unsigned int unit;
     xen_disk_info_t *xen_xdi = map_domain_mem(virt_to_phys(xdi));
-    unsigned long capacity;
+    unsigned long capacity, device;
     ide_drive_t *drive;
     
     for ( loop = 0; loop < MAX_HWIFS; loop++ )
@@ -25,9 +25,10 @@ void ide_probe_devices(xen_disk_info_t* xdi)
             drive = &hwif->drives[unit];
             if ( !drive->present ) continue;
             
+            device   = MK_IDE_XENDEV((loop * MAX_DRIVES) + unit);
             capacity = current_capacity(drive);
-            xen_xdi->disks[xen_xdi->count].device =
-                MK_IDE_XENDEV((loop * MAX_DRIVES) + unit);
+
+            xen_xdi->disks[xen_xdi->count].device   = device;
             xen_xdi->disks[xen_xdi->count].capacity = capacity;
             xen_xdi->count++;
 
index a2a245fddc94ffc0ebe7c774d32ea4a760006713..88e7ce814aa07fa044b03fdc5f69257ec10dcd4d 100644 (file)
@@ -1320,17 +1320,21 @@ void scsi_probe_devices(xen_disk_info_t *xdi)
     Scsi_Disk *sd; 
     int i;
     xen_disk_info_t *xen_xdi = map_domain_mem(virt_to_phys(xdi));
+    unsigned long capacity, device;
 
     for ( sd = rscsi_disks, i = 0; i < sd_template.dev_max; i++, sd++ )
     {
         if ( sd->device == NULL ) continue;
 
-        xen_xdi->disks[xen_xdi->count].device   = MK_SCSI_XENDEV(i);
-        xen_xdi->disks[xen_xdi->count].capacity = sd->capacity; 
+        device   = MK_SCSI_XENDEV(i);
+        capacity = sd->capacity;
+
+        xen_xdi->disks[xen_xdi->count].device   = device;
+        xen_xdi->disks[xen_xdi->count].capacity = capacity; 
         xen_xdi->count++; 
                 
         printk("Disk %d: SCSI-XENO capacity %dkB (%dMB)\n",
-               xen_xdi->count, sd->capacity>>1, sd->capacity>>11);
+               xen_xdi->count, capacity>>1, capacity>>11);
     }
 
     unmap_domain_mem(xen_xdi);
index bfdfa50c3ead4843b793d6386e478936f31c8cd8..6fd44f1cc135c099b37bfbc03205d9d9dd3759a5 100644 (file)
@@ -522,8 +522,8 @@ int __init xlblk_init(void)
     blk_ring = (blk_ring_t *)fix_to_virt(FIX_BLKRING_BASE);
     blk_ring->req_prod = blk_ring->resp_prod = resp_cons = req_prod = 0;
     
-    error = request_irq(XLBLK_RESPONSE_IRQ, xlblk_response_int, 0, 
-                       "xlblk-response", NULL);
+    error = request_irq(XLBLK_RESPONSE_IRQ, xlblk_response_int, 
+                        SA_SAMPLE_RANDOM, "xlblk-response", NULL);
     if ( error )
     {
        printk(KERN_ALERT "Could not allocate receive interrupt\n");
index 7e85bf5abe0dd8996790d7cf6a5b3980c685db42..86bbeb921aae79037183236a98272c04161264fb 100644 (file)
@@ -116,8 +116,8 @@ static int network_open(struct net_device *dev)
 
     network_alloc_rx_buffers(dev);
 
-    error = request_irq(NET_RX_IRQ, network_rx_int, 0, 
-                        "net-rx", dev);
+    error = request_irq(NET_RX_IRQ, network_rx_int, 
+                        SA_SAMPLE_RANDOM, "net-rx", dev);
     if ( error )
     {
         printk(KERN_WARNING "%s: Could not allocate receive interrupt\n",
@@ -126,8 +126,8 @@ static int network_open(struct net_device *dev)
         goto fail;
     }
 
-    error = request_irq(NET_TX_IRQ, network_tx_int, 0, 
-                        "net-tx", dev);
+    error = request_irq(NET_TX_IRQ, network_tx_int, 
+                        SA_SAMPLE_RANDOM, "net-tx", dev);
     if ( error )
     {
         printk(KERN_WARNING "%s: Could not allocate transmit interrupt\n",